﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FrameConstructor;


namespace TetrisShape
{
    public class Render
    {
        public void Print(Shape sh, Frame fr, Field fi)
        {
            Console.Clear();
            fi.SetGameField();
            sh.SetColor();
            foreach (Shape currentShape in sh.ReturnShape)
            {
                foreach (Block currentBlock in currentShape.ReturnBlock)
                {
                    Console.CursorVisible = false;
                    Console.SetCursorPosition(currentBlock.X, currentBlock.Y);
                    Console.WriteLine("■");
                }
            }
            foreach (Shape shape in fi.ReturnShapeStorage)
            {
                sh.SetFieldColor();
                foreach (Block block in shape.ReturnBlock)
                {
                    Console.CursorVisible = false;
                    Console.SetCursorPosition(block.X, block.Y);
                    Console.WriteLine("■");
                }
            }
        }
        //public void PrintShape(Shape sh)
        //{

        //    foreach (Block bl in sh.ReturnBlock)
        //    {
        //        Console.CursorVisible = false;
        //        Console.SetCursorPosition(bl.X, bl.Y);
        //        Console.WriteLine("■");
        //    }
        //}

        //public void ClearShape(Shape sh, Frame fr)
        //{
        //    foreach (Block bl in sh.ReturnBlock)
        //    {
        //        if (bl.X == fr.StartX + 5 && bl.Y == fr.StartY + 1 || bl.X == fr.StartX + 6 && bl.Y == fr.StartY + 1 || bl.X == fr.StartX + 7 && bl.Y == fr.StartY + 1)
        //        { }
        //        else
        //        {
        //            Console.SetCursorPosition(bl.X, bl.Y - 1);
        //            Console.WriteLine(" ");
        //        }
        //    }
        //}
    }
}
